//
//  VipCardRecordViewController.m
//  fitnessmanage
//
//  Created by 众拳科技 on 2017/11/1.
//  Copyright © 2017年 zongquankeji. All rights reserved.
//

#import "VipCardRecordViewController.h"
#import "VipCardRecordView.h"
#import "VipCardRecordDetailTableViewCell.h"

@interface VipCardRecordViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic,strong) VipCardRecordView *vipCardRecordView;

@property(nonatomic,weak)UITableView *tableView;

@property(nonatomic,strong)NSMutableArray *dataSource;

@end

@implementation VipCardRecordViewController

- (void)viewDidLoad {
    
    [super viewDidLoad];
   
    self.title = @"消费记录";
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self createSubView];
    
}

-(void)createSubView{
    
    UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStylePlain];
    tableView.dataSource = self;
    tableView.delegate = self;
    tableView.showsVerticalScrollIndicator = NO;
    //tableView.estimatedRowHeight = 200;
    [tableView registerClass:[VipCardRecordDetailTableViewCell class] forCellReuseIdentifier:@"VipCardRecordDetailTableViewCell"];
    tableView.separatorStyle = UITableViewCellSelectionStyleNone;
    tableView.backgroundColor = BackGroundColor;
    [self.view addSubview:tableView];
    [tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(self.view);
    }];
    
    VipCardRecordView *vipCardRecordView = [[VipCardRecordView alloc] init];
    [self.view addSubview:vipCardRecordView];
    self.vipCardRecordView = vipCardRecordView;
    
    [vipCardRecordView mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(tableView);
        make.left.width.mas_equalTo(self.view);
    }];
    
    [vipCardRecordView setNeedsLayout];
    [vipCardRecordView layoutIfNeeded];
    
    tableView.tableHeaderView = vipCardRecordView;
}

#pragma mark UITableViewDataSource

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return 4;
    
    //return self.dataSource.count;
}

#pragma mark UITableViewDelegate

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    
    return nil;
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    
    return 0.00001;
}

-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    
    return nil;
}

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    
    return 0.00001;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
    return 80;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    VipCardRecordDetailTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"VipCardRecordDetailTableViewCell"];
    
    
    
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}


-(NSMutableArray *)dataSource
{
    if (!_dataSource) {
                
        _dataSource = [[NSMutableArray alloc] init];
    }
    return _dataSource;
}

@end
